package com.itheima.controller;

import com.itheima.pojo.Result;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class SessionController {
    @GetMapping("/setSession")
    public Result setSession(HttpSession session){
        session.setAttribute("dingzhen","xuebao");
        return Result.success();
    }

    @GetMapping("/getSession")
    public Result getSession(HttpSession session){
        Object dingzhen = session.getAttribute("dingzhen");
        log.info("dingzhen:{}",dingzhen);
        return Result.success();
    }
}
